home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 24
/
AMIGAplus Sonderheft 24 (2000)(Falke)(DE)[!].iso
/
PublicDomain
/
Anwendungen
/
MT-RechnungIII
/
Rexx
/
Import_MTRechnungII.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1998-11-01
|
13KB
|
471 lines
/*
** Importieren der Daten von MT-RechnungII in MT-RechnungIII
** $VER: Import_MTRechnungII.rexx V1.02 (01.11.98)
*/
PARSE ARG ARexxPort;
ADDRESS VALUE ARexxPort;
OPTIONS RESULTS;
LF = '0a'x; /* Zeilenvorschub */
RC = 0;
/* Oberfläche sperren */
LOCKGUI;
/* Prüfen, ob nicht bereits Daten vorhanden sind (darf nicht sein) */
NUMBER_ADDRESS;
AnzahlAdressen = MTR_RESULT;
NUMBER_ARTICLE;
AnzahlArtikel = MTR_RESULT;
NUMBER_OUTBILL;
AnzahlRechnung = MTR_RESULT;
IF (AnzahlAdressen + AnzahlArtikel + AnzahlRechnung) > 0 THEN
DO;
ES_TITLE = "Achtung!!!!";
ES_TEXTFORMAT = "Die Daten können nur importiert werden," || LF || "wenn noch keine Eingaben erfolgten.";
ES_GADGETFORMAT = "Abbrechen";
EASY_REQUEST;
RC = 1;
END;
/* Einstellungsdatei auswählen */
IF RC = 0 THEN
DO;
ASLFR_TITLETEXT = "Wählen Sie die Einstellungsdatei";
ASLFR_INITIALDRAWER = "ram:";
ASLFR_INITIALPATTERN = "#?.dat";
ASLFR_INITIALFILE = "Prefs.dat";
ASL_FILE_REQUEST;
IF MTR_RESULT = "" THEN
RC = 1;
ELSE
DO;
PrefsDatei = MTR_RESULT;
j = 0;
i = INDEX( PrefsDatei, "/");
DO WHILE( i > 0 );
j = i;
i = INDEX( PrefsDatei, "/", i+1);
END;
IF J = 0 THEN
J = INDEX( PrefsDatei, ":" );
Vorgabeverzeichnis = SUBSTR( PrefsDatei, 1, J );
END;
END;
/* Artikeldatei auswählen */
IF RC = 0 THEN
DO;
ASLFR_TITLETEXT = "Wählen Sie die Artikeldatei";
ASLFR_INITIALDRAWER = Vorgabeverzeichnis;
ASLFR_INITIALPATTERN = "#?.dat";
ASLFR_INITIALFILE = "Artikel.dat";
ASL_FILE_REQUEST;
IF MTR_RESULT = "" THEN
RC = 1;
ELSE
DO;
ArtikelDatei = MTR_RESULT;
END;
END;
/* Kundendatei auswählen */
IF RC = 0 THEN
DO;
ASLFR_TITLETEXT = "Wählen Sie die Kundendatei";
ASLFR_INITIALDRAWER = Vorgabeverzeichnis;
ASLFR_INITIALPATTERN = "#?.dat";
ASLFR_INITIALFILE = "Kunden.dat";
ASL_FILE_REQUEST;
IF MTR_RESULT = "" THEN
RC = 1;
ELSE
DO;
KundenDatei = MTR_RESULT;
END;
END;
/* Rechnungsdatei auswählen */
IF RC = 0 THEN
DO;
ASLFR_TITLETEXT = "Wählen Sie die Rechnungsdatei";
ASLFR_INITIALDRAWER = Vorgabeverzeichnis;
ASLFR_INITIALPATTERN = "#?.dat";
ASLFR_INITIALFILE = "Rechnung.dat";
ASL_FILE_REQUEST;
IF MTR_RESULT = "" THEN
RC = 1;
ELSE
DO;
RechnungsDatei = MTR_RESULT;
END;
END;
/* Noch kein Fehler Aufgetreten? */
IF RC = 0 THEN
DO;
/* Länder einlesen */
NUMBER_COUNTRY;
AnzLaender = MTR_RESULT;
DO i = 1 to AnzLaender;
GET_COUNTRY i;
LandesName.i = COUNTRY.NAME;
END;
/* Einstellungen anpassen */
GET_PREFS;
IF OPEN(P_dat,PrefsDatei,'read') THEN
DO;
PREFS.VALUEPERCENT.0 = READLN(P_dat);
PREFS.VALUEPERCENT.1 = READLN(P_dat);
CLOSE(P_dat);
END;
ELSE
DO;
PREFS.VALUEPERCENT.0 = 16;
PREFS.VALUEPERCENT.1 = 7;
END;
PREFS.CURRENCY_USED = 1;
IF PREFS.ADD_RED_USED = 0 THEN
DO;
PREFS.ADD_RED_USED = 1;
PREFS.ADD_RED_TEXT.0 = "Nachlass %";
PREFS.ADD_RED_TYPE.0 = 5;
END;
SET_PREFS;
/* Artikel einlesen */
IF OPEN(A_dat,ArtikelDatei,'read') THEN
DO;
DO forever;
AR_ArtBez = READLN(A_dat);
IF EOF(A_dat) THEN LEAVE;
AR_ArtPreis = READLN(A_dat);
AR_ArtBuch = READLN(A_dat);
AR_ArtMWST = READLN(A_dat);
IF AR_ArtMWSt < '1' | AR_ArtMWSt > '9' THEN
AR_ArtMWSt = 1;
NEW_ARTICLE;
Artikelnummer = MTR_RESULT;
ARTICLE.DESCRIPTION = AR_ArtBez;
ARTICLE.BOOK_KEEPING_ACCOUNT = AR_ArtBuch;
ARTICLE.VALUE_USED = AR_ArtMWSt - 1;
ARTICLE.PRICE.0.1 = AR_ArtPreis;
ARTICLE.CURRENCY_USED = 1;
SET_ARTICLE Artikelnummer;
END;
CLOSE(A_dat);
END;
/* Adressen einlesen */
IF OPEN(K_dat,KundenDatei,'read') THEN
DO;
DO forever;
VorName = READLN(K_dat);
IF EOF(K_dat) THEN LEAVE;
NachName = READLN(K_dat);
Strasse = READLN(K_dat);
PLZ = READLN(K_dat);
ORT = READLN(K_dat);
Land = READLN(K_dat);
GebTag = READLN(K_dat);
Rabatt = READLN(K_dat);
Tel = READLN(K_dat);
Fax = READLN(K_dat);
Dfue = READLN(K_dat);
EMail1 = READLN(K_dat);
EMail2 = READLN(K_dat);
EMail3 = READLN(K_dat);
Anrede = READLN(K_dat);
BAnr = READLN(K_dat);
Komm = READLN(K_dat);
BLZ = READLN(K_dat);
BankBez = READLN(K_dat);
BankKurz = READLN(K_dat);
Konto = READLN(K_dat);
NEW_ADDRESS;
Adressnummer = MTR_RESULT;
SELECT;
WHEN Anrede = "Fräulein" THEN
DO;
ADDRESS.SALUTATION = 1;
END;
WHEN Anrede = "Frau" THEN
DO;
ADDRESS.SALUTATION = 2;
END;
WHEN Anrede = "Herr" | Anrede = "Herrn" THEN
DO;
ADDRESS.SALUTATION = 3;
END;
WHEN Anrede = "Familie" THEN
DO;
ADDRESS.SALUTATION = 4;
END;
OTHERWISE
DO;
ADDRESS.SALUTATION = 0;
END;
END;
ADDRESS.SURNAME = NachName;
ADDRESS.PRENAME = VorName;
ADDRESS.STREET = Strasse;
ADDRESS.ZIP = PLZ;
ADDRESS.CITY = ORT;
SELECT;
WHEN Land = "Germany" | Land = "" THEN
Land = "Deutschland";
WHEN Land = "Austria" THEN
Land = "Österreich";
WHEN Land = "Swiss" THEN
Land = "Schweiz";
OTHERWISE
NOP;
END;
j = 0;
DO i = 1 to AnzLaender WHILE(j = 0);
IF Land = LandesName.i THEN
j = i;
END;
IF j = 0 THEN
DO;
NEW_COUNTRY;
AnzLaender = MTR_RESULT;
i = MTR_RESULT;
COUNTRY.NAME = Land;
LandesName.i = COUNTRY.NAME;
SELECT;
WHEN COUNTRY.NAME = "Deutschland" THEN
DO;
COUNTRY.SYMBOL = "D-";
COUNTRY.PHONE_HOME = "0";
COUNTRY.PHONE_FOREIGN = "00";
COUNTRY.PHONE_FROMFOREIGN = "49";
COUNTRY.STATE.0 = "Baden-Würtemberg"
COUNTRY.STATE.1 = "Bayern";
COUNTRY.STATE.2 = "Berlin";
COUNTRY.STATE.3 = "Brandenburg";
COUNTRY.STATE.4 = "Bremen";
COUNTRY.STATE.5 = "Hamburg";
COUNTRY.STATE.6 = "Hessen";
COUNTRY.STATE.7 = "Mecklenburg-Vorpommern";
COUNTRY.STATE.8 = "Niedersachsen";
COUNTRY.STATE.9 = "Nordrhein-Westfalen";
COUNTRY.STATE.10 = "Rheinland-Pfalz";
COUNTRY.STATE.11 = "Saarland";
COUNTRY.STATE.12 = "Sachsen";
COUNTRY.STATE.13 = "Sachsen-Anhalt";
COUNTRY.STATE.14 = "Schleswig-Holstein";
COUNTRY.STATE.15 = "Thüringen";
END;
WHEN COUNTRY.NAME = "Österreich" THEN
DO;
COUNTRY.SYMBOL = "A-";
COUNTRY.PHONE_HOME = "0";
COUNTRY.PHONE_FOREIGN = "00";
COUNTRY.PHONE_FROMFOREIGN = "43";
COUNTRY.STATE.0 = "Burgenland"
COUNTRY.STATE.1 = "Kärnten";
COUNTRY.STATE.2 = "Niederösterreich";
COUNTRY.STATE.3 = "Oberösterreich";
COUNTRY.STATE.4 = "Salzburg";
COUNTRY.STATE.5 = "Steiermark";
COUNTRY.STATE.6 = "Tirol";
COUNTRY.STATE.7 = "Vorarlberg";
COUNTRY.STATE.8 = "Wien";
END;
WHEN COUNTRY.NAME = "Schweiz" THEN
DO;
COUNTRY.SYMBOL = "CH-";
COUNTRY.PHONE_HOME = "0";
COUNTRY.PHONE_FOREIGN = "00";
COUNTRY.PHONE_FROMFOREIGN = "41";
COUNTRY.STATE.0 = "Aargau"
COUNTRY.STATE.1 = "Appenzell Außer-Rhoden";
COUNTRY.STATE.2 = "Appenzell Inner-Rhoden";
COUNTRY.STATE.3 = "Basel-Land";
COUNTRY.STATE.4 = "Basel-Stadt";
COUNTRY.STATE.5 = "Bern";
COUNTRY.STATE.6 = "Freiburg";
COUNTRY.STATE.7 = "Genf";
COUNTRY.STATE.8 = "Glarus";
COUNTRY.STATE.9 = "Graubünden";
COUNTRY.STATE.10 = "Luzern";
COUNTRY.STATE.11 = "Neuenburg";
COUNTRY.STATE.12 = "Sankt Gallen";
COUNTRY.STATE.13 = "Schaffhausen";
COUNTRY.STATE.14 = "Schwyz";
COUNTRY.STATE.15 = "Solothurn";
CO